package com.example.factory;

import java.util.UUID;

import com.example.entity.Order;

public class OrderFactory {
	private Order order = null;
	private static OrderFactory orderFactory = null;

	private OrderFactory() {
	}

	public static OrderFactory getOrderFactory() {
		if (orderFactory == null) {
			synchronized (OrderFactory.class) {
				if (orderFactory == null) {
					orderFactory = new OrderFactory();
				}
			}
		}
		return orderFactory;
	}

	public synchronized Order getOrder() {
		order = new Order();
		order.setOrderId(UUID.randomUUID().toString().replaceAll("-", ""));
		return order;
	}
}
